/*    */ package com.qmsk.business.qrcode.service;
/*    */ 
/*    */ import com.qmsk.business.qrcode.controller.QrCodeController;
/*    */ import com.qmsk.business.qrcode.dao.ScanRecordDAO;
/*    */ import com.qmsk.business.qrcode.dao.SubscribeRecordDAO;
/*    */ import com.utils.gson.in.GsonHeadOneRow;
/*    */ import com.utils.jdbc.connection.DbConnection;
/*    */ import java.util.Date;
/*    */ import org.apache.log4j.Logger;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Service;
/*    */ 
/*    */ @Service
/*    */ public class QrCodeService
/*    */ {
/* 18 */   private Logger logger = Logger.getLogger(QrCodeController.class);
/*    */ 
/*    */   @Autowired
/*    */   private SubscribeRecordDAO subscribeRecordDAO;
/*    */ 
/*    */   @Autowired
/*    */   private ScanRecordDAO scanRecordDAO;
/*    */ 
/*    */   public void recordSubscribe(String openId, String sceneId)
/*    */     throws Exception
/*    */   {
/*    */     try
/*    */     {
/* 34 */       String[] head = { "sceneId", "openId", 
/* 35 */         "createFileTime" };
/* 36 */       Object[] list = { sceneId, openId, new Date() };
/* 37 */       GsonHeadOneRow row = new GsonHeadOneRow(head, list);
/* 38 */       int n = this.subscribeRecordDAO.insertGsonHeadOneRow(row);
/* 39 */       if (n <= 0) {
/* 40 */         this.logger.error("关注记录失败!");
/* 41 */         DbConnection.rollback();
/* 42 */         return;
/*    */       }
/* 44 */       this.logger.debug("关注记录成功!");
/* 45 */       DbConnection.commit();
/*    */     } catch (Exception e) {
/* 47 */       this.logger.error("记录关注信息失败！");
/* 48 */       this.logger.error("openId:" + openId);
/* 49 */       this.logger.error("sceneId" + sceneId);
/*    */     }
/*    */   }
/*    */ 
/*    */   public void recordScan(String openId, String sceneId)
/*    */     throws Exception
/*    */   {
/*    */     try
/*    */     {
/* 62 */       String[] head = { "sceneId", "openId", 
/* 63 */         "createFileTime" };
/* 64 */       Object[] list = { sceneId, openId, new Date() };
/* 65 */       GsonHeadOneRow row = new GsonHeadOneRow(head, list);
/* 66 */       int n = this.scanRecordDAO.insertGsonHeadOneRow(row);
/* 67 */       if (n <= 0) {
/* 68 */         this.logger.error("扫描记录失败!");
/* 69 */         DbConnection.rollback();
/* 70 */         return;
/*    */       }
/* 72 */       DbConnection.commit();
/* 73 */       this.logger.debug("扫描记录成功!");
/*    */     } catch (Exception e) {
/* 75 */       this.logger.error("记录扫描信息失败！");
/* 76 */       DbConnection.rollback();
/*    */ 
/* 78 */       this.logger.error("openId:" + openId);
/* 79 */       this.logger.error("sceneId" + sceneId);
/*    */     }
/*    */   }
/*    */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.qrcode.service.QrCodeService
 * JD-Core Version:    0.5.3
 */